//
//  ImageColl.m
//  BeautyClother
//
//  Created by dllo on 15/8/24.
//  Copyright (c) 2015年 宋爽. All rights reserved.
//

#import "ImageColl.h"

@interface ImageColl ()
@property (nonatomic, assign) CGFloat offWidth;
@property (nonatomic, assign) CGFloat offHeight;

@end

@implementation ImageColl

- (void)dealloc
{
    [_title release];
    [_price release];
    [_image release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.image = [[UIImageView alloc]init];
        [self.contentView addSubview:self.image];
        [_image release];
        self.title = [[UILabel alloc]init];
        [self.contentView addSubview:self.title];
        [_title release];
        _price = [[UILabel alloc]init];
        [self.contentView addSubview:_price];
        [_price release];
        
        self.source = [[UIButton alloc]init];
        [self.contentView addSubview:self.source];
        self.offWidth = [[UIScreen mainScreen]bounds].size.width / 375;
        self.offHeight = [[UIScreen mainScreen]bounds].size.height / 667;
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.image.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height - 60 * _offHeight);
    self.title.frame = CGRectMake(10* _offWidth, self.contentView.frame.size.height - 55 * _offHeight, self.contentView.frame.size.width - 20 *_offWidth, 20* _offHeight);
    _image.layer.cornerRadius = 5;
    _image.layer.masksToBounds = YES;
    _title.textColor = [UIColor darkGrayColor];
    _title.font = [UIFont systemFontOfSize:15];
    
    self.price.frame = CGRectMake(10*_offWidth, self.contentView.frame.size.height - 30* _offHeight, 85 *_offWidth, 20* _offHeight);
    self.price.textColor = [UIColor colorWithRed:255/255 green:0 blue:255/ 255 alpha:0.5];
    self.source.frame = CGRectMake(100*_offWidth, self.contentView.frame.size.height - 30* _offHeight, 80*_offWidth, 20* _offHeight);
    [self.source setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    _source.titleLabel.font = [UIFont systemFontOfSize:15];

}

@end
